const three = this.pageObj.getApiWidgetByAliasName('三维组件');
const type_selection = this.pageObj.getApiWidgetByAliasName('type_selection');
const type = $(type_selection.__box).find('input[type="radio"]:checked').val();

console.log(type);

function breakDataSource(item) {
  if (item.personId) {
    item.title = item.accountName || "测试";
    item.userId = item.account;
    item.treeId = item.id;
  } else if(item.orgId || item.orgName) {
    item.title = item.orgName;
    item.id = item.orgId;
    item.treeId = item.orgId;
  } else if (item.deptId || item.deptName) {
    item.title = item.deptName;
    item.id = item.deptId;
    item.treeId = item.deptId;
  }

  item.type = '1'; // 叶子节点标识
  if (item.values) {
    item.children = item.values.map(breakDataSource);
    item.type = '0'
  }
  if (item.child) {
    item.children = item.child.map(breakDataSource);
    item.type = '0'
  }

  return item
}

const artemis = three?.widgetObj?.artemis;
const { option_data } = this.widgetObj;

if (artemis && option_data) {
  const dataSrouce = option_data.map(breakDataSource);
  if (type === 'online' && artemis) {
    this.widgetObj.option_data = artemis.filterUsersOnline(dataSrouce);
  } else if (type === 'offline' && artemis) {
    this.widgetObj.option_data = artemis.filterUsersOnline(dataSrouce, true);
  }

  console.log(this.widgetObj.option_data, dataSrouce);
}
